package com.example.android2019.ch5broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;

public class MyReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        // an Intent broadcast.
        /*throw new UnsupportedOperationException("Not yet implemented");*/
        String number = getResultData();
        SharedPreferences sp = context.getSharedPreferences("phone", Context.MODE_PRIVATE);
        String phone = sp.getString("phone", null);
        if (number.equals(phone)) {
            setResultData(null);
        }
    }
}
